package com.hp.airmap.input;

import android.os.Bundle;
import android.support.v7.widget.RecyclerView;

import com.hp.airmap.R;
import com.hp.airmap.common.MvpBaseActivity;
import com.hp.airmap.model.Photo;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;


public class MvpActivity extends MvpBaseActivity<Contact.View, MvpPresenter> implements Contact.View {

    @BindView(R.id.rvAlbum)
    RecyclerView rvAlbum;

    private MyAdapter myAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_mvp);
        ButterKnife.bind(this);

        myAdapter = new MyAdapter(R.layout.item_photo);
        rvAlbum.setAdapter(myAdapter);

        //加载数据
        showLoading();
        mPresenter.getPhotos();

    }

    @Override
    public void onPhotosUpdate(List<Photo> photos) {
        hideLoading();
        myAdapter.setNewData(photos);

    }

    @Override
    protected MvpPresenter createPresenter() {
        return new MvpPresenter();
    }

}
